$('#myTab a').click(function(e){e.preventDefault()
$(this).tab('show')})
$('#tab-episode a').click(function(e){e.preventDefault()
$(this).tab('show')})
$(window).scroll(function(){if($(this).scrollTop()>0){$('#header').addClass('fix-navar');}else{$('#header').removeClass('fix-navar');}});jQuery(document).ready(function($){var offset=300,offset_opacity=1200,scroll_top_duration=700,$back_to_top=$('.cd-top');$(window).scroll(function(){($(this).scrollTop()>offset)?$back_to_top.addClass('cd-is-visible'):$back_to_top.removeClass('cd-is-visible cd-fade-out');if($(this).scrollTop()>offset_opacity){$back_to_top.addClass('cd-fade-out');}});$back_to_top.on('click',function(event){event.preventDefault();$('body,html').animate({scrollTop:0,},scroll_top_duration);});});jQuery(window).load(function(){jQuery("#hungry-preloader-container").fadeOut("slow")})
$('#myModal').on('shown.bs.modal',function(){$('#myInput').focus();	$("#myModal-2,#myModal-3,.modal-backdrop").hide();});$('#myModal-2').on('shown.bs.modal',function(){$('#myInput').focus();$("#myModal,#myModal-3,.modal-backdrop").hide();});$('#myModal-3').on('shown.bs.modal',function(){$('#myInput').focus();$("#myModal,#myModal-2,.modal-backdrop").hide();});jQuery(document).ready(function($){$('.btn_lg').click(function(event){$.post($('#frm_login_users').attr('action'),$('#frm_login_users').serialize(),function(result){if(result.error==1){$('#myModal-2 .modal-content').html(result.content);}else{$('#myModal-2 .modal-content').html(result.content);var url = location.href.toLowerCase();window.location.href = url;}},'json');});});
jQuery(document).ready(function($) {
	$('.btn-request').click(function(event) {
		$.post($('#frm_Request_New').attr('action'),$('#frm_Request_New').serialize() , function(result) {
			if(result.error == 1){
				$('#myModal .modal-content').html(result.content);
			}else{
				$('#myModal .modal-content .modal-body').html('<div class="form-group text-center"><h3 class="fadeInLeftBig animated">thank you for the comments ...!</h3></div>');
				$('.btn-request').css({display: 'none'});
			}
		},'json');
	});
});
jQuery(document).ready(function($) {
	$('.btn-regis').click(function(event) {
		$.post($('#frm-registered').attr('action'),$('#frm-registered').serialize() , function(result) {
			if(result.error == 1){
				$('#myModal-3 .modal-content').html(result.content);
			}else{
				$('#myModal-3 .modal-content .modal-body').html('<div class="form-group text-center"><h3 class="fadeInLeftBig animated">thank you for the registered ...!</h3></div>');
				$('.btn-regis').css({display: 'none'});
				$('.btn-default').click(function(event) {
					var url = location.href.toLowerCase();
					window.location.href = url; 
				});
			}
		},'json');
	});
});
function addcontrols(name_controls){
	var url = location.href.toLowerCase();
	$.post(url, {controls:name_controls}, function(result) {
		if(result.error == 1){
			$.notification({type:"error",img:"",width:"400",content:"<i class='fa fa-check fa-2x'></i> "+result.content+"",html:true,autoClose:true,timeOut:"1500",delay:"0",position:"topRight",effect:"fade",animate:"fadeUp",easing:"jswing",onStart:function(id){ console.log(' onStart : notification id = '+id); },onShow:function(id){ console.log(' onShow : notification id = '+id); },onClose:function(id){ console.log(' onClose : notification id = '+id); },duration:"300"}); 
		}else{
			$.notification({type:"success",img:"",width:"400",content:"<i class='fa fa-check fa-2x'></i> "+result.content+"",html:true,autoClose:true,timeOut:"1500",delay:"0",position:"topRight",effect:"fade",animate:"fadeUp",easing:"jswing",onStart:function(id){ console.log(' onStart : notification id = '+id); },onShow:function(id){ console.log(' onShow : notification id = '+id); },onClose:function(id){ console.log(' onClose : notification id = '+id); },duration:"300"}); 
			$("#"+name_controls).addClass('active-controls');	
		}
	},'json');
}
function search_key() {
	$("#keyword").keyup(function (event) {
		if($("#keyword").val().length > 0){
			$('input[name="keyword"]').autoComplete({
			    minChars: 1,
			    source: function(term, suggest){
			        term = term.toLowerCase();
			        var choices = new Array();
			        $.each(ins_search,function(key,val) {
			        	choices.push(val.title);
			        
			        });
			        var matches = [];
			        for (i=0; i<choices.length; i++)
			            if (~choices[i].toLowerCase().indexOf(term)) matches.push(choices[i]);

			        $('.autocomplete-suggestions').css("width","auto");
			        suggest(matches);
			    },
			    onSelect: function(e, term, item){
		        	var url = $(".logo a").attr("href");
		        	var key = term.replace(' ','+'); 
			    	window.location.href = url+'search.html?'+'keyword='+key
			    }
			});
		
		}
	});
}
jQuery(document).ready(function($) {
	search_key();
});
jQuery(document).ready(function($) {
    var zoombtn = false;
   $("#zoom").click(function(event) {
        if(zoombtn == false){
            $(".embed-responsive").animate({width: "1140px", height: "600px"}, 500);
            $("#tab-sibar").css('margin-top','676px');
            zoombtn = true;
        }else{
            $(".embed-responsive").animate({width: "750px", height: "422px"}, 500);
             $("#tab-sibar").css('margin-top','0px');
            zoombtn = false;
        }
        return false;
   });
});
